package com.tamecode.context;

import com.tamecode.reflect.Car;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;

import static org.junit.Assert.assertNotNull;

/**
 * @Author: LiQiongchao
 * @Date: 2021/8/5 21:29
 */
public class AnnotationApplicationContextTest {

    @Test
    public void getBean() {

        // 能过一个带 @Configuration 的 POJO 装载 Bean 的配置
        ApplicationContext context = new AnnotationConfigApplicationContext(Beans.class);
        Car car = context.getBean(Car.class);
        car.introduce();
        assertNotNull(car);

    }

}
